<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<html>
<head>
<title>点兵点将</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="javascript">
 
// global variables
var timer;
var flag = new Array(100);
var existingnum = new Array(100);
var clickTimes = 0;
var randnum;
var cellnum =1;
var mobile = new Array();
var keyBlank = 0;
// set data here!!
mobile[0]='孟庆诚'
mobile[1]='刘玉豪'
mobile[2]='戴少乐'
mobile[3]='张优'
mobile[4]='魏茂磊'
mobile[5]='卢远伟'
mobile[6]='杨传平'
mobile[7]='刘茂飞'
mobile[8]='吴亮亮'
mobile[9]='车立红'
mobile[10]='孙玉峰'
mobile[11]='朱清稳'
mobile[12]='陈彬'
mobile[13]='李振宇'
mobile[14]='张峰'
mobile[15]='刘先科'
mobile[16]='于兴伟'
mobile[17]='牛加旺'
mobile[18]='刘杰'
mobile[19]='张传海'
mobile[20]='倪硕'
mobile[21]='郭凯强'
mobile[22]='杨海宁'
mobile[23]='刘金名'
mobile[24]='冯天祥'
mobile[25]='王涛'
mobile[26]='杜雪'
mobile[27]='朱文欣'
mobile[28]='张恩慧'
mobile[29]='王庆志'
mobile[30]='徐晓凤'
mobile[31]='刘甜甜'
mobile[32]='刘富叶'
mobile[33]='康娟'
mobile[34]='魏娜'
mobile[35]='魏萧萧'
mobile[36]='耿俊美'
mobile[37]='张珂'
mobile[38]='苏玉杰'
mobile[39]='林明霞'
mobile[40]='张秀'
mobile[41]='王寿霞'
mobile[42]='张心龙'
mobile[43]='刘士豹'



function start(){
clearInterval(timer);
timer = setInterval('change()',20); //
}
function ok(){
clearInterval(timer);
}

//开始点击执行方法
function setTimer(){
 //keyBlank = 1;// 置为1,开始已执行,下一步执行停止.
  timer = setInterval("getRandNum();",10);    //设置滚动循环间隔时间
  document.getElementById("start").disabled = true; //设置开始按钮为不可点击
  document.getElementById("end").disabled = false; //设置结束按钮为可点击
}
 var num = mobile.length-1;       //总的长度减1
function getRandNum(){
 document.getElementById("result").value = mobile[GetRnd(0,num)]; //显示框 显示的数据
 //alert(mobile[GetRnd(0,num)]);
}
//取随机数
function GetRnd(min,max){        
 randnum = parseInt(Math.random()*(max-min+1));
 return randnum;
}
//结束执行方法
function clearTimer(){
 //keyBlank = 0;// 置为0,结束已执行,下一步执行开始.
 noDupNum();
 clearInterval(timer);
 document.getElementById("start").disabled = false;
 document.getElementById("end").disabled = true;
 
}
//去掉已选中姓名
function noDupNum(){
 // to remove the selected mobile phone number
 mobile.removeEleAt(randnum);
 // to reorganize the mobile number array!!
 var o = 0;
 for(p=0; p<mobile.length;p++){
  if(typeof mobile[p]!="undefined"){
   mobile[o] = mobile[p];
   o++;
  }
 }
//数组长度减1
 num = mobile.length-1;
 }
// method to remove the element in the array
//移走已选中姓名
Array.prototype.removeEleAt = function(dx)
 {
 if(isNaN(dx)||dx>this.length){return false;}
 this.splice(dx,1);
 }
// set mobile phone numbers to the table cell
function setValues(){
// if(cellnum==45){//历史框已经写满
//  toend();
// }
 document.getElementById(cellnum).value = document.getElementById("result").value ;
 cellnum++;
 }
function showKeyName(e)
{
if(e.keyCode==32&&keyBlank==0){
 blankStart();
 //setTimer();
 return;
}
if(e.keyCode==32&&keyBlank==1){
 //clearTimer();setValues();
 blankStop();
 return;
}
}
//设置键盘标示位属性
function setKeyBlank(value){
 keyBlank = value; 
}
//键盘空格开始
function  blankStart(){
 setTimer();
 setKeyBlank(1);
}
//键盘空格停止
function  blankStop(){
 clearTimer();
 setValues();
 setKeyBlank(0);
}
function toend(){
 location.reload();
}
</script>
<style type="text/css">
html{ background:url(img/3393020_174850719000_2.jpg) no-repeat right;}
body,input{color: #10418D;font-family: "黑体";}
body{ background:url(img/e.jpg) repeat-x bottom}
table{ border-collapse:collapse}
td{ border:1px solid #0099FF;}
td input{ border:0; text-align:center; font-weight:bold}
caption{ margin:0; border:1px solid #0099FF; border-bottom:none; padding:10px 0; font-size:30px; }
#start,#end{ background:url(img/butbg.jpg) no-repeat; width:99px; height:34px; border:0; color:#fff; font-size:16px;}
</style>
</head>
<body onkeyup="showKeyName(event)">
<center>
<div></div>
<div id="main">
<div>
<input id="result" type="text" size="30" style="height: 100px; width: 300px; border: 2px solid #09f; font-size:50px; font-family:'经典超圆简'; text-align:center; line-height:100px; background-color: #E3FBFB; margin-top:200px;" readonly />
<p>
<input id="start" type="button" value="开始" onClick="setTimer();setKeyBlank(1);" /> 
<input id="end" type="button" value="停"  onClick="clearTimer();setValues();setKeyBlank(0);" disabled />
  
</p>
<table width="961"  cellspacing="0">
<caption>选中历史</caption>
 <tr>
  <td><input name="text1" type="text" id="1" style="height: 30px; width: 190px; font-size: 25;" size="28" readonly /></td>
  <td><input name="text2" type="text" id="2" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
  <td><input name="text3" type="text" id="3" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
  <td><input name="text4" type="text" id="4" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
  <td><input name="text5" type="text" id="5" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
 </tr>
 <tr>
  <td><input name="text6" type="text" id="6" style="height: 30px; width: 190px; font-size: 25;" size="28" readonly /></td>
  <td><input name="text7" type="text" id="7" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
  <td><input name="text8" type="text" id="8" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
  <td><input name="text9" type="text" id="9" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
  <td><input name="text10" type="text" id="10" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
 </tr>
 <tr>
  <td><input name="text11" type="text" id="11" style="height: 30px; width: 190px; font-size: 25;" size="28" readonly /></td>
  <td><input name="text12" type="text" id="12" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
  <td><input name="text13" type="text" id="13" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
  <td><input name="text14" type="text" id="14" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
  <td><input name="text15" type="text" id="15" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
 </tr>
 <tr>
  <td><input name="text16" type="text" id="16" style="height: 30px; width: 190px; font-size: 25;" size="28" readonly /></td>
  <td><input name="text17" type="text" id="17" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
  <td><input name="text18" type="text" id="18" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
  <td><input name="text19" type="text" id="19" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
  <td><input name="text20" type="text" id="20" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
 </tr>
 
 <tr>
  <td><input name="text21" type="text" id="21" style="height: 30px; width: 190px; font-size: 25;" size="28" readonly /></td>
  <td><input name="text22" type="text" id="22" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
  <td><input name="text23" type="text" id="23" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
  <td><input name="text24" type="text" id="24" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
  <td><input name="text25" type="text" id="25" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
 </tr>
 <tr>
  <td><input name="text26" type="text" id="26" style="height: 30px; width: 190px; font-size: 25;" size="28" readonly /></td>
  <td><input name="text27" type="text" id="27" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
  <td><input name="text28" type="text" id="28" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
  <td><input name="text29" type="text" id="29" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
  <td><input name="text30" type="text" id="30" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
 </tr>
  <tr>
  <td><input name="text31" type="text" id="31" style="height: 30px; width: 190px; font-size: 25;" size="28" readonly /></td>
  <td><input name="text32" type="text" id="32" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
  <td><input name="text33" type="text" id="33" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
  <td><input name="text34" type="text" id="34" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
  <td><input name="text35" type="text" id="35" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
 </tr>
 <tr>
  <td><input name="text36" type="text" id="36" style="height: 30px; width: 190px; font-size: 25;" size="28" readonly /></td>
  <td><input name="text37" type="text" id="37" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
  <td><input name="text38" type="text" id="38" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
  <td><input name="text39" type="text" id="39" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
  <td><input name="text40" type="text" id="40" style="height: 30px; width: 190px; font-size: 25;" size="20" readonly /></td>
 </tr>

</table>
<p></p>
<p></p>
<p></p>
</div>
</div>
</center>
</body>
</html>